//ES代码
// enum Direction {
//   Up,
//   Down,
//   Left,
//   Right,
// }

enum Direction {
  Up = 5,
  Down,
  Left,
  Right,
}

function walk(direction: Direction) {
  if (direction == Direction.Up) {
    console.log("向上走");
  }
  if (direction == Direction.Down) {
    console.log("向下走");
  }
}

walk(Direction.Up);

walk(Direction.Down);

console.log("Direction", Direction);
console.log("Direction.Up", Direction.Up);
console.log("Direction.Down", Direction.Down);

enum Week {
  Mon = 1,
  Tues,
  Wed,
  Thus,
  Fri,
  Sat,
  Sun = 0,
}

console.log("Week", Week);

console.log("Week[0] ", Week[0]);
console.log("Week[1] ", Week[1]);
console.log("Week[2] ", Week[2]);
console.log("Week[3] ", Week[3]);
console.log("Week[4] ", Week[4]);
console.log("Week[5] ", Week[5]);
console.log("Week[6] ", Week[6]);

//字符串类型的枚举

enum StrDirection {
  Up = "up",
  Down = "down",
  Left = "left",
  Right = "right",
}
console.log("StrDirection", StrDirection);
// StrDirection[0]
